package cn.iocoder.yudao.module.jifenyuan.dal.mysql.walletlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.jifenyuan.dal.dataobject.walletlog.WalletLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.jifenyuan.controller.app.walletlog.vo.*;

/**
 * 记分员 钱包记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface WalletLogMapper extends BaseMapperX<WalletLogDO> {

    default PageResult<WalletLogDO> selectPage(AppWalletLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<WalletLogDO>()
                .eqIfPresent(WalletLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(WalletLogDO::getType, reqVO.getType())
                .eqIfPresent(WalletLogDO::getScore, reqVO.getScore())
                .betweenIfPresent(WalletLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WalletLogDO::getId));
    }

    default List<WalletLogDO> selectList(AppWalletLogExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<WalletLogDO>()
                .eqIfPresent(WalletLogDO::getUserId, reqVO.getUserId())
                .eqIfPresent(WalletLogDO::getType, reqVO.getType())
                .eqIfPresent(WalletLogDO::getScore, reqVO.getScore())
                .betweenIfPresent(WalletLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(WalletLogDO::getId));
    }

}
